<?php
/**
 * Created by PhpStorm.
 * User: zzw
 * Date: 17-5-1
 * Time: 下午9:34
 */
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class App extends Modules_Controller
{

    function __construct()
    {
        parent::__construct();

        $this->rules = array(
            "rule" => array(
            )
        );

    }

    public function copypro()
    {
        $ids = $this->input->post('ids');

        $rs=$this->model->get_one($ids);

        unset($rs['id']);
        unset($rs['sort_id']);
        unset($rs['timeline']);

        $id = $this->model->create($rs);
        if ($id) {
            $vdata['msg'] = '复制成功，请刷新查看';
            $vdata['status'] = 1;
        }else{
            $vdata['msg'] = '复制失败，请刷新后重试';
            $vdata['status'] = 0;
        }
        $this->output->set_content_type('application/json')->set_output(json_encode($vdata));
    }
    protected function _create_data(){
        $form=$this->input->post();
        if($form['files']) {
            $files = one_upload($form['files']);
            $form['url'] = UPLOAD_URL.$files['url'];
        }
        $form['timeline'] = time();
        return $form;
    }
    protected function _edit_data(){
        $form=$this->input->post();
        if($form['files']) {
            $files = one_upload($form['files']);
            $form['url'] = UPLOAD_URL.$files['url'];
        }
        $form['timeline'] = time();
        return $form;
    }

}